<?php

use yii\widgets\ActiveForm;
use common\helpers\Url;
use common\enums\StatusEnum;
use kartik\date\DatePicker;
$form = ActiveForm::begin([
    'id' => $model->formName(),
    'enableAjaxValidation' => true,
    'class' => 'form-horizontal',
    'validationUrl' => Url::to(['ajax-edit', 'id' => $model['id']]),
    'fieldConfig' => [
        'template' => "<div class='col-sm-3 text-right'>{label}</div><div class='col-sm-9'>{input}\n{hint}\n{error}</div>",
    ]
]);
?>

    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
            <h4 class="modal-title">基本信息</h4>
        </div>
        <div class="modal-body">

            <?= $form->field($model, 'name')->textInput()?>
            <?= $form->field($model, 'grade_id')->dropDownList($menuDropDownLists) ?>


<!--        时间控件-->
<!--            --><?//= $form->field($model, 'starting_time')->widget(DatePicker::classname(), [
//                'options' => ['placeholder' => ''],
//                'pluginOptions' => [
//                    'autoclose' => true,
//                    'todayHighlight' => true,
//                    'format' => 'yyyy-mm-dd',
//                ]
//            ]); ?>

            <?= $form->field($model, 'starting_time')->widget(kartik\datetime\DateTimePicker::class, [
                'language' => 'zh-CN',
                'options' => [
                    'value' => $model->isNewRecord ? date('Y-m-d H:i:s') : date('Y-m-d H:i:s',$model->starting_time),
                ],
                'pluginOptions' => [
                    'format' => 'yyyy-mm-dd hh:ii',
                    'todayHighlight' => true, // 今日高亮
                    'autoclose' => true, // 选择后自动关闭
                    'todayBtn' => true, // 今日按钮显示
                ]
            ]);?>
<!--        时间控件-->
<!--            --><?//= $form->field($model, 'finish_time')->widget(DatePicker::classname(), [
//                'options' => ['placeholder' => ''],
//                'pluginOptions' => [
//                    'autoclose' => true,
//                    'todayHighlight' => true,
//                    'format' => 'yyyy-mm-dd',
//                ]
//            ]); ?>


            <?= $form->field($model, 'finish_time')->widget(kartik\datetime\DateTimePicker::class, [
                'language' => 'zh-CN',
                'options' => [
                    'value' => $model->isNewRecord ? date('Y-m-d H:i:s') : date('Y-m-d H:i:s',$model->finish_time),
                ],
                'pluginOptions' => [
                    'format' => 'yyyy-mm-dd hh:ii',
                    'todayHighlight' => true, // 今日高亮
                    'autoclose' => true, // 选择后自动关闭
                    'todayBtn' => true, // 今日按钮显示
                ]
            ]);?>

<!--上传请假凭证-->
<!--            --><?//= $form->field($model, 'certificate')->widget(\common\widgets\cropper\Cropper::class, [
//                // 'theme' => 'default',
//                'config' => [
//                    // 可设置自己的上传地址, 不设置则默认地址
//                    // 'server' => '',
//                ],
//            ]); ?>
            <?= $form->field($model, 'phone')->textInput()?>
            <?= $form->field($model, 'reason')->textarea(['rows'=>3])?>
            <?= $form->field($model, 'type')->radioList(StatusEnum::type())?>
            <?= $form->field($model, 'status')->radioList(StatusEnum::getMap()) ?>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
            <button class="btn btn-primary" type="submit">保存</button>
        </div>
    </div>
<?php ActiveForm::end(); ?>